package com.cm.caseManagement.service.impl;


import com.cm.caseManagement.dao.CmAdvanceDetailMapper;
import com.cm.caseManagement.pojo.entity.CmAdvanceDetail;
import com.cm.caseManagement.service.ICmAdvanceDetailService;
import com.cm.caseManagement.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 垫付明细Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-05
 */
@Service
public class CmAdvanceDetailServiceImpl implements ICmAdvanceDetailService
{
    @Autowired
    private CmAdvanceDetailMapper cmAdvanceDetailMapper;

    /**
     * 查询垫付明细
     *
     * @param id 垫付明细主键
     * @return 垫付明细
     */
    @Override
    public CmAdvanceDetail selectCmAdvanceDetailById(Long id)
    {
        return cmAdvanceDetailMapper.selectCmAdvanceDetailById(id);
    }

    /**
     * 查询垫付明细列表
     *
     * @param cmAdvanceDetail 垫付明细
     * @return 垫付明细
     */
    @Override
    public List<CmAdvanceDetail> selectCmAdvanceDetailList(CmAdvanceDetail cmAdvanceDetail)
    {
        return cmAdvanceDetailMapper.selectCmAdvanceDetailList(cmAdvanceDetail);
    }

    /**
     * 新增垫付明细
     *
     * @param cmAdvanceDetail 垫付明细
     * @return 结果
     */
    @Override
    public int insertCmAdvanceDetail(CmAdvanceDetail cmAdvanceDetail)
    {
        cmAdvanceDetail.setCreateTime(DateUtils.getNowDate());
        return cmAdvanceDetailMapper.insertCmAdvanceDetail(cmAdvanceDetail);
    }

    /**
     * 修改垫付明细
     *
     * @param cmAdvanceDetail 垫付明细
     * @return 结果
     */
    @Override
    public int updateCmAdvanceDetail(CmAdvanceDetail cmAdvanceDetail)
    {
        cmAdvanceDetail.setUpdateTime(DateUtils.getNowDate());
        return cmAdvanceDetailMapper.updateCmAdvanceDetail(cmAdvanceDetail);
    }

    /**
     * 批量删除垫付明细
     *
     * @param ids 需要删除的垫付明细主键
     * @return 结果
     */
    @Override
    public int deleteCmAdvanceDetailByIds(Long[] ids)
    {
        return cmAdvanceDetailMapper.deleteCmAdvanceDetailByIds(ids);
    }

    /**
     * 删除垫付明细信息
     *
     * @param id 垫付明细主键
     * @return 结果
     */
    @Override
    public int deleteCmAdvanceDetailById(Long id)
    {
        return cmAdvanceDetailMapper.deleteCmAdvanceDetailById(id);
    }
}
